﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ProtoWinform
{
    public partial class FormChangedPwd : Form
    {
        public FormChangedPwd()
        {
            InitializeComponent();
        }

        public string OldPwd { get; set; }

        private void simpleButton2_Click(object sender, EventArgs e)
        {

            if (opwd.Text != OldPwd)
            {
                this.msg.Text = "老密码不对！";
                return;
            }

            if (tpwd1.Text != tpwd2.Text)
            {


                this.msg.Text = "两次密码不一样！";
                return;
            }

            DialogResult = DialogResult.OK;
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;

        }

        public string Msg { get=>this.msg.Text ;
            set { this.msg.Text = value; }
        }
        public string Pwd { get=>this.tpwd2.Text ;
            set { this.tpwd2.Text = value; }
        }

        private void tpwd_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
            DialogResult = DialogResult.OK;
            }
        }

        private void PasswordPromptForm_Activated(object sender, EventArgs e)
        {
            this.opwd.Focus();

        }
    }
}
